package com.lw.easyexcel.service.impl;

import com.lw.easyexcel.mapper.UserMapper;
import com.lw.easyexcel.pojo.User;
import com.lw.easyexcel.service.UserService;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Description:
 * @ClassName: UserServiceImpl
 * @Author: lanwei
 * @Date: 2022/12/14 17:14
 */
@Service
@Transactional
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;


    @Transactional
    @Override
    public Integer getCount() {
        return userMapper.selectCount(new User());
    }

    @Transactional
    @Override
    public List<User> getUserByPage(Integer pageCount) {

        Integer begin = pageCount * 50000 - 50000;
        //每页的数据数
        Integer limit = 50000;
        return userMapper.selectByRowBounds(new User(),new RowBounds(begin,limit));
    }
}
